#include<stdio.h>
int main(){
	int x;
	scanf("%d",&x);
	int sum=0;
	int u=1;
	while(x!=0){
		sum+=(x%10)*u;
		u*=2;
		x=int(x/10);
	}
	printf("%d",sum);
}
